import $http from '../utils/http.js'
import { Notification } from 'atelement'
const changeLoading = 'mechanism/changeLoading'
const getDate = 'mechanism/getDate' // 将接口取值赋值到store
const getCurrent = 'mechanism/getCurrent' // 设置当前页码
const getPageize = 'mechanism/getPageize' // 设置页码大小
const getValues = 'mechanism/getValues' // 设置模糊搜索值
const setFilters = 'mechanism/setFilters' // 设置过滤条件
const setOrderby = 'mechanism/setOrderby' // 设置排序条件
const getMechanism = 'mechanism/getMechanism' // 获取机构信息
const setMechanism = 'mechanism/setMechanism' // 新增/修改机构信息
const delMechanism = 'mechanism/delMechanism' // 删除机构信息
const getNodename = 'mechanism/getNodename' // 获取上级单位选项信息
const setNodename = 'mechanism/setNodename' // 设置上级单位选项信息
const getNodeselect = 'mechanism/getNodeselect' // 筛选机构选项
const setNodeselect = 'mechanism/setNodeselect' // 设置筛选机构选项
const getNodetype = 'mechanism/getNodetype' // 筛选机构类型选项
const setNodetype = 'mechanism/setNodetype' // 设置筛选机构类型选项
const getSupervisionnode = 'mechanism/getSupervisionnode' // 获取监管单位选项信息
const setSupervisionnode = 'mechanism/setSupervisionnode' // 设置监管单位选项信息
const getArea = 'mechanism/getArea' // 获取大区信息(1)筛选选项(2)区域下拉框
const setArea = 'mechanism/setArea' // 设置大区信息(1)筛选选项(2)区域下拉框
const getNodedetails = 'mechanism/getNodedetails' // 获取详情
const setNodedetails = 'mechanism/setNodedetails' // 设置详情
const getUpdatedetails = 'mechanism/getUpdatedetails' // 获取详情
const setNodeupdatedetails = 'mechanism/setNodeupdatedetails'
const getFdepartment = 'mechanism/getFdepartment' // 获取机构树信息
const getSupervision = 'mechanism/getSupervision' // 获取监管树信息
const setDepartmenttree = 'mechanism/setDepartmenttree' // 机构树
const setSupervisiontree = 'mechanism/setSupervisiontree' // 监管树
const setDepartmentkey = 'mechanism/setDepartmentkey' // 机构树key
const setSupervisionkey = 'mechanism/setSupervisionkey' // 监管树key
const addmechanis = 'mechanism/addmechanis' // 新增组件切换
const upmechanis = 'mechanism/upmechanis' // 修改组件切换
const mechanismDetalie = 'mechanism/mechanismDetalie' // 详情组件切换
const treeShow = 'mechanism/treeShow' // 树组件切换
const setAreaselect = 'mechanism/setAreaselect'
const setTypeselect = 'mechanism/setTypeselect'
const getAreatree = 'mechanism/getAreatree' // 省市区三级联动
const setAreaTree = 'mechanism/setAreaTree' // 省市区三级联动
const getSyncCount = 'mechanism/getSyncCount' // 同步信息数量
const setSyncCount = 'mechanism/setSyncCount' // 同步信息数量
const getSyncmessage = 'mechanism/getSyncmessage' // 获取变更信息
const setSyncmessage = 'mechanism/setSyncmessage'
const delSyncmessage = 'mechanism/delSyncmessage' // 清除变更信息
const syncOrder = 'mechanism/syncOrder' // 同步信息排序
const syncFilters = 'mechanism/syncFilters' // 同步信息筛选
const getSynclog = 'mechanism/getSynclog' // 变更历史信息
const gethisadd = '/mechanism/gethisadd' // 历史新增数据
const Muahischangepageadd = '/mechanism/Muahischangepageadd' // 历史新增分页前提交MUA
const MuahischangePageSizeadd = '/mechanism/MuahischangePageSizeadd' // 历史新增改变每页条数前提交Mua
const Muahissearchadd = '/mechanism/Muahissearchadd' // 历史新增搜索前提交MUA
const MuahisSortadd = '/mechanism/MuahisSortadd' // 历史新增排序前提交MUA
const gethisupdate = '/mechanism/gethisupdate' // 历史更改数据
const Muahischangepageedit = '/mechanism/Muahischangepageedit' // 历史更改分页前提交MUA
const MuahischangePageSizeedit = '/mechanism/MuahischangePageSizeedit' // 历史更改改变每页条数前提交Mua
const Muahissearchedit = '/mechanism/Muahissearchedit' // 历史更改搜索前提交MUA
const MuahisSortedit = '/mechanism/MuahisSortedit' // 历史更改排序前提交MUA
const gethisdelete = '/mechanism/gethisdelete' // 历史删除数据
const Muahischangepagedel = '/mechanism/Muahischangepagedel' // 历史删除分页前提交MUA
const MuahischangePageSizedel = '/mechanism/MuahischangePageSizedel' // 历史删除改变每页条数前提交Mua
const Muahissearchdel = '/mechanism/Muahissearchdel' // 历史删除搜索前提交MUA
const MuahisSortdel = '/mechanism/MuahisSortdel' // 历史删除排序前提交MUA

const setSynclog = 'mechanism/setSynclog'
const mechanismSyncvalue = 'mechanism/mechanismSyncvalue'
export default {
  state: {
    loading: false,
    addSync: [],
    updateSync: [],
    deleteSync: [],
    syncCount: 0,
    supervisionNode: [],
    areaTree: [],
    typeSelect: [],
    areaSelect: [],
    treeShow: true,
    addmechanis: false,
    upmechanis: false,
    mechanismDetalie: false,
    nodeSelect: [],
    departmentList: [],
    supervisionList: [],
    departmentTreeKey: [],
    supervisionTreeKey: [],
    nodeDetails: {},
    nodeupdateDetails: {},
    setMechanism: false,
    area: [],
    department: [], // 机构选项
    options: [], // 机构类型
    division: [], // 上级单位
    mechanismDate: {
      'pagination': { // 分页
        'current': 1, // 当前页码，类型：number
        'pageSize': 20 // 单页面数据条数，类型：number
      },
      'filters': { // 需要被过滤的字段
        'ctype_name': [],
        'abelong_area': [],
        'astatus': []
      },
      'search': { 'value': '' }, // 搜索字段
      'total': null, // 获取信息总数
      'table': [], // 机构信息列表
      'sorter': {
        'field': 'ar_time', // 排序的字段
        'order': 'descend' // or 'desc'升序还是降序
      }
    },
    syncLog: {
      'pagination': { // 分页
        'current': 1, // 当前页码，类型：number
        'pageSize': 20 // 单页面数据条数，类型：number
      },
      'search': { 'value': '' },
      'total': null,
      'filters': {
        'anode_type_change': [] // 需要过滤的字段
      },
      'sorter': {
        'field': 'zr_time', // 排序的字段
        'order': 'descend' // or 'desc'升序还是降序
      },
      'dict': { 'type': 'add' },
      'table': [] // 用户信息列表
    },
    syncDate: {
      'sorter': {
        'field': 'zr_time', // 排序的字段
        'order': 'descend' // or 'desc'升序还是降序
      },
      'filters': {
        'aagency_type_change': [] // 需要过滤的字段
      },
      'dict': { 'type': 'add' },
      'addtable': [], // 用户信息列表,
      'uptable': [],
      'deltable': []
    },
    history_add: {
      tableData: {
        'pagination': {
          'current': 1, // 当前页码
          'pageSize': 20// 当前页显示的数据条数
        },
        'search': {
          'value': '' // 需要模糊搜索的值（搜索框）
        },
        'fifters': {
          ctype_name: []
        },
        'sorter': {
          'field': 'zr_time', // 排序的字段
          'order': 'descend' // or "desc"升序还是降序
        }
      },
      table: [], /* 图表数据 */
      total: 0 /* Y条数 */
    },
    history_edit: {
      tableData: {
        'pagination': {
          'current': 1, // 当前页码
          'pageSize': 20// 当前页显示的数据条数
        },
        'search': {
          'value': '' // 需要模糊搜索的值（搜索框）
        },
        'fifters': {
          ctype_name: []
        },
        'sorter': {
          'field': 'zr_time', // 排序的字段
          'order': 'descend' // or "desc"升序还是降序
        }
      },
      table: [], /* 图表数据 */
      total: 0 /* Y条数 */
    },
    history_del: {
      tableData: {
        'pagination': {
          'current': 1, // 当前页码
          'pageSize': 20// 当前页显示的数据条数
        },
        'search': {
          'value': '' // 需要模糊搜索的值（搜索框）
        },
        'fifters': {
          ctype_name: []
        },
        'sorter': {
          'field': 'zr_time', // 排序的字段
          'order': 'descend' // or "desc"升序还是降序
        }
      },
      table: [], /* 图表数据 */
      total: 0 /* Y条数 */
    }
  },
  actions: {
    [getSynclog] ({ commit, state }, data) {
      let form = JSON.parse(JSON.stringify(state.syncLog))
      form.dict.type = data.type
      $http.option('/api/mechanism/synclog', form).then(({ status, data, msg } = {}) => {
        if (status === 'success') {
          commit(setSynclog, data)
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取变更历史信息失败'
          })
        }
      })
    },
    [delSyncmessage] ({ commit }) {
      $http.post('/api/mechanism/delsnyccount').then(({ status, msg } = {}) => {
        if (status === 'success') {
          Notification.success({
            title: '删除成功'
          })
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取变更信息失败'
          })
        }
      })
    },
    [getSyncmessage] ({ commit, state }, data) {
      let form = JSON.parse(JSON.stringify(state.syncDate))
      form.dict.type = data.type
      $http.option('/api/mechanism/snycmessage', form).then(({ status, msg } = {}) => {
        if (status === 'success') {
          commit(setSyncmessage, { 'type': data, 'data': msg })
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取变更信息失败'
          })
        }
      })
    },
    [getSyncCount] ({ commit }) {
      $http.post('/api/mechanism/snyccount').then(({ msg, status } = {}) => {
        if (status === 'success') {
          commit(setSyncCount, msg)
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取变更信息数量失败'
          })
        }
      })
    },
    [getAreatree] ({ commit }, data) {
      $http.post('/api/search/area/list', data).then(({ data, status, msg } = {}) => {
        if (status === 'success') {
          commit(setAreaTree, data)
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取区域树信息失败'
          })
        }
      })
    },
    [getNodedetails] ({ commit }, data) {
      $http.post('/api/mechanism/details', data).then(({ status, msg } = {}) => {
        if (status === 'success') {
          if (msg.length > 0) {
            commit(setNodedetails, msg[0])
          }
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取机构详情信息失败'
          })
        }
      })
    },
    [getUpdatedetails] ({ commit }, data) {
      $http.post('/api/mechanism/details', data).then(({ status, msg } = {}) => {
        if (status === 'success') {
          if (msg.length > 0) {
            commit(setNodeupdatedetails, msg[0])
          }
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取机构详情信息失败'
          })
        }
      })
    },
    [getArea] ({ commit }, data) {
      $http.post('api/mechanism/region').then(({ status, msg } = {}) => {
        if (status === 'success') {
          const option = []
          if (data === 1) {
            for (let i = 0; i < msg.length; i++) {
              let areaName = {}
              areaName['value'] = msg[i].area_name
              areaName['text'] = msg[i].area_name
              option.push(areaName)
            }
            commit(setArea, option)
          } else {
            commit(setAreaselect, msg)
          }
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取区域筛选信息失败'
          })
        }
      })
    },
    [setMechanism] ({ dispatch, state, commit }, data = { func: () => {} }) {
      $http.post('api/mechanism/message' + data.type, data.msg).then(({ status, msg } = {}) => {
        if (status === 'success') {
          dispatch(getMechanism)
          commit(treeShow, true)
          commit(mechanismDetalie, false)
          dispatch(getFdepartment)
          dispatch(getSupervision)
          state.setMechanism = false
          data.func()
          Notification.success({
            title: '操作成功'
          })
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '操作失败'
          })
        }
      })
    },
    [getNodetype] ({ commit }, data) {
      $http.post('api/mechanism/type').then(({ status, msg } = {}) => {
        if (status === 'success') {
          const option = []
          if (data === 1) {
            for (let i = 0; i < msg.length; i++) {
              let tradeName = {}
              tradeName['value'] = msg[i].type_name
              tradeName['text'] = msg[i].type_name
              tradeName['type_id'] = msg[i].type_id
              option.push(tradeName)
            }
            commit(setNodetype, option)
          } else {
            commit(setTypeselect, msg)
          }
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取机构类型失败'
          })
        }
      })
    },
    [getNodename] ({ commit }, data) {
      $http.post('api/mechanism/node', data).then(({ status, msg } = {}) => {
        if (status === 'success') {
          commit(setNodename, msg)
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取机构选项失败'
          })
        }
      })
    },
    [getSupervisionnode] ({ commit }, data) {
      $http.post('api/mechanism/supervision', data).then(({ status, msg } = {}) => {
        if (status === 'success') {
          commit(setSupervisionnode, msg)
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取监管机构信息失败'
          })
        }
      })
    },
    [getNodeselect] ({ commit }) {
      $http.post('api/mechanism/node', { 'anode_name': '1', 'type': 'user' }).then(({ status, msg } = {}) => {
        if (status === 'success') {
          let option = []
          for (let i = 0; i < msg.length; i++) {
            let nodeName = {}
            nodeName['value'] = msg[i].node_name
            nodeName['text'] = msg[i].node_name
            nodeName['key'] = msg[i].node_id
            option.push(nodeName)
          }
          commit(setNodeselect, option)
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取机构选项失败'
          })
        }
      })
    },
    [delMechanism] ({ dispatch, commit }, data) {
      $http.post('api/mechanism/delete', data).then(({ status, msg } = {}) => {
        if (status === 'success') {
          dispatch(getMechanism)
          dispatch(getFdepartment)
          dispatch(getSupervision)
          Notification.success({
            title: '删除机构成功'
          })
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: msg
          })
        }
      })
    },
    [getSupervision] ({ commit }) {
      $http.get('/api/department/supervision').then(({ status, msg, key } = {}) => {
        if (status === 'success') {
          commit(setSupervisiontree, msg)
          var list = []
          for (var i = 0; i < key.length; i++) {
            if (key[i].supervision_node_id) {
              list.push(key[i].supervision_node_id)
            }
          }
          commit(setSupervisionkey, list)
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取监管机构树信息失败'
          })
        }
      })
    },
    [getFdepartment] ({ commit }) {
      $http.get('/api/department/fdepartment').then(({ status, msg, key } = {}) => {
        if (status === 'success') {
          commit(setDepartmenttree, msg)
          var list = []
          for (var i = 0; i < key.length; i++) {
            list.push(key[i].agency_id)
          }
          commit(setDepartmentkey, list)
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取组织机构树信息失败'
          })
        }
      })
    },
    [getMechanism] ({ commit, state }) {
      const form = state.mechanismDate
      commit(changeLoading, true)
      $http.option('api/mechanism/message', form).then(({ status, msg } = {}) => {
        if (status === 'success') {
          commit(changeLoading, false)
          commit(getDate, msg)
        } else if (status === 'notallow') {
          Notification.error({
            title: '不具备权限'
          })
        } else if (status === 'fail') {
          Notification.error({
            title: '获取机构信息失败'
          })
        }
      })
    },
    // 获取历史新增数据
    [gethisadd] ({ commit, state, dispatch }, obj) {
      if (obj === undefined) {
        obj = 'type'
      }
      if (obj.type === 'pagCur') {
        commit(Muahischangepageadd, obj.page)
      } else if (obj.type === 'pagSize') {
        commit(MuahischangePageSizeadd, obj.pageSizes)
      } else if (obj.type === 'search') {
        commit(Muahissearchadd, { value: obj.value, currentPage: obj.currentPage })
      } else if (obj.type === 'sorter') {
        commit(MuahisSortadd, { key: obj.key, value: obj.value })
      }
      const sat = {
        pagination: {
          'current': state.history_add.tableData.pagination.current,
          'pageSize': state.history_add.tableData.pagination.pageSize
        },
        search: {
          'value': state.history_add.tableData.search.value
        },
        sorter: {
          'order': state.history_add.tableData.sorter.order,
          'field': state.history_add.tableData.sorter.field
        }
      }
      $http.option('/api/mechanism/history_add', sat
      ).then(({ status, data } = {}) => {
        if (status === 'success') {
          commit(gethisadd, data)
          commit(changeLoading)
        }
      }).catch(function (err) {
        console.log(err)
      })
    },
    // 获取历史更改数据
    [gethisupdate] ({ commit, state, dispatch }, obj) {
      if (obj === undefined) {
        obj = 'type'
      }
      if (obj.type === 'pagCur') {
        commit(Muahischangepageedit, obj.page)
      } else if (obj.type === 'pagSize') {
        commit(MuahischangePageSizeedit, obj.pageSizes)
      } else if (obj.type === 'search') {
        commit(Muahissearchedit, { value: obj.value, currentPage: obj.currentPage })
      } else if (obj.type === 'sorter') {
        commit(MuahisSortedit, { key: obj.key, value: obj.value })
      }
      const sat = {
        pagination: {
          'current': state.history_edit.tableData.pagination.current,
          'pageSize': state.history_edit.tableData.pagination.pageSize
        },
        search: {
          'value': state.history_edit.tableData.search.value
        },
        sorter: {
          'order': state.history_edit.tableData.sorter.order,
          'field': state.history_edit.tableData.sorter.field
        }
      }
      $http.option('/api/mechanism/history_update', sat
      ).then(({ status, data } = {}) => {
        if (status === 'success') {
          commit(gethisupdate, data)
          commit(changeLoading)
        }
      }).catch(function (err) {
        console.log(err)
      })
    },
    // 获取历史删除数据
    [gethisdelete] ({ commit, state, dispatch }, obj) {
      if (obj === undefined) {
        obj = 'type'
      }
      if (obj.type === 'pagCur') {
        commit(Muahischangepagedel, obj.page)
      } else if (obj.type === 'pagSize') {
        commit(MuahischangePageSizedel, obj.pageSizes)
      } else if (obj.type === 'search') {
        commit(Muahissearchdel, { value: obj.value, currentPage: obj.currentPage })
      } else if (obj.type === 'sorter') {
        commit(MuahisSortdel, { key: obj.key, value: obj.value })
      }
      const sat = {
        pagination: {
          'current': state.history_del.tableData.pagination.current,
          'pageSize': state.history_del.tableData.pagination.pageSize
        },
        search: {
          'value': state.history_del.tableData.search.value
        },
        sorter: {
          'order': state.history_del.tableData.sorter.order,
          'field': state.history_del.tableData.sorter.field
        }
      }
      $http.option('/api/mechanism/history_del', sat
      ).then(({ status, data } = {}) => {
        if (status === 'success') {
          commit(gethisdelete, data)
          commit(changeLoading)
        }
      }).catch(function (err) {
        console.log(err)
      })
    }
  },
  mutations: {
    [setSynclog] (state, value) {
      state.syncLog.table = value.dataSource
      state.syncLog.total = value.total
      state.syncLog.pagination.current = value.current
    },
    [mechanismSyncvalue] (state, value) {
      state.syncLog.search.value = value
    },
    [getDate] (state, data) {
      state.mechanismDate.pagination.current = data.current
      state.mechanismDate.total = data.total
      state.mechanismDate.table = data.dataSource
    },
    [getCurrent] (state, val) {
      state.mechanismDate.pagination.current = val
    },
    [getPageize] (state, val) {
      state.mechanismDate.pagination.pageSize = val
    },
    [getValues] (state, value) {
      state.mechanismDate.search.value = value
    },
    [setSupervisionnode] (state, value) {
      state.supervisionNode = value
    },
    [setNodename] (state, value) {
      state.division = value
    },
    [setNodetype] (state, value) {
      state.options = value
    },
    [changeLoading] (state, value) {
      state.loading = value
    },
    [setArea] (state, value) {
      state.area = value
    },
    [setAreaselect] (state, value) {
      state.areaSelect = value
    },
    [setNodeselect] (state, value) {
      state.nodeSelect = value
    },
    [setNodedetails] (state, value) {
      state.nodeDetails = JSON.parse(JSON.stringify(value))
    },
    [setNodeupdatedetails] (state, value) {
      state.nodeupdateDetails = JSON.parse(JSON.stringify(value))
    },
    [setDepartmentkey] (state, value) {
      state.departmentTreeKey = value
    },
    [setSupervisionkey] (state, value) {
      state.supervisionTreeKey = value
    },
    [setOrderby] (state, value) {
      state.mechanismDate.sorter.field = value.prop
      state.mechanismDate.sorter.order = value.order
    },
    [setDepartmenttree] (state, value) {
      state.departmentList = value
    },
    [setSupervisiontree] (state, value) {
      state.supervisionList = value
    },
    [setAreaTree] (state, value) {
      for (var i = 0; i < value.length; i++) {
        if (value[i].children.length >= 1) {
          for (var j = 0; j < value[i].children.length; j++) {
            if (value[i].children[j].value == null) {
              value[i].children.splice(j, 1)
            }
            if (value[i].children[j] !== undefined) {
              if (value[i].children[j].children.length >= 1) {
                for (var k = 0; k < value[i].children[j].children.length; k++) {
                  if (value[i].children[j].children[k].value == null) {
                    value[i].children[j].children.splice(k, 1)
                  }
                }
              }
            }
          }
        }
      }
      state.areaTree = value
    },
    [setFilters] (state, { key, value }) {
      if (key === 'type_name') {
        state.mechanismDate.filters.ctype_name = value
      } else if (key === 'area_name') {
        state.mechanismDate.filters.abelong_area = value
      }
    },
    [addmechanis] (state, value) {
      state.addmechanis = value
    },
    [upmechanis] (state, value) {
      state.upmechanis = value
    },
    [mechanismDetalie] (state, value) {
      state.mechanismDetalie = value
    },
    [treeShow] (state, value) {
      state.treeShow = value
    },
    [setTypeselect] (state, value) {
      state.typeSelect = value
    },
    [setSyncCount] (state, value) {
      state.syncCount = value.count
    },
    [setSyncmessage] (state, value) {
      if (value.type.type === 'add') {
        state.syncDate.addtable = value.data
      } else if (value.type.type === 'update') {
        state.syncDate.uptable = value.data
      } else {
        state.syncDate.deltable = value.data
      }
    },
    [syncOrder] (state, value) {
      state.syncDate.sorter.field = value.prop
      state.syncDate.sorter.order = value.order
      state.syncLog.sorter.field = value.prop
      state.syncLog.sorter.order = value.order
    },
    [syncFilters] (state, value) {
      state.syncDate.filters.aagency_type_change = value
      state.syncLog.filters.aagency_type_change = value
    },
    // 历史新增分页前提交MUA
    [Muahischangepageadd] (state, page) {
      state.history_add.tableData.pagination.current = page
    },
    // 历史新增改变每页条数前提交到MUA
    [MuahischangePageSizeadd] (state, pageSizes) {
      state.history_add.tableData.pagination.pageSize = pageSizes
    },
    // 历史新增搜索前提交到MUA
    [Muahissearchadd] (state, query) {
      state.history_add.tableData.search.value = query.value
      state.history_add.tableData.pagination.current = query.currentPage
    },
    // 历史新增表格排序前提交MUA
    [MuahisSortadd] (state, { key, value }) {
      state.history_add.tableData.sorter.order = value
      state.history_add.tableData.sorter.field = key
    },
    // 历史新增数据
    [gethisadd] (state, data) {
      state.history_add.table = data.dataSource
      state.history_add.total = data.total
    },
    // 历史更改分页前提交MUA
    [Muahischangepageedit] (state, page) {
      state.history_edit.tableData.pagination.current = page
    },
    // 历史更改改变每页条数前提交到MUA
    [MuahischangePageSizeedit] (state, pageSizes) {
      state.history_edit.tableData.pagination.pageSize = pageSizes
    },
    // 历史更改搜索前提交到MUA
    [Muahissearchedit] (state, query) {
      state.history_edit.tableData.search.value = query.value
      state.history_edit.tableData.pagination.current = query.currentPage
    },
    // 历史更改表格排序前提交MUA
    [MuahisSortedit] (state, { key, value }) {
      state.history_edit.tableData.sorter.order = value
      state.history_edit.tableData.sorter.field = key
    },
    // 历史更改数据
    [gethisupdate] (state, data) {
      state.history_edit.table = data.dataSource
      state.history_edit.total = data.total
    },
    // 历史删除分页前提交MUA
    [Muahischangepagedel] (state, page) {
      state.history_del.tableData.pagination.current = page
    },
    // 历史删除改变每页条数前提交到MUA
    [MuahischangePageSizedel] (state, pageSizes) {
      state.history_del.tableData.pagination.pageSize = pageSizes
    },
    // 历史删除搜索前提交到MUA
    [Muahissearchdel] (state, query) {
      state.history_del.tableData.search.value = query.value
      state.history_del.tableData.pagination.current = query.currentPage
    },
    // 历史删除表格排序前提交MUA
    [MuahisSortdel] (state, { key, value }) {
      state.history_del.tableData.sorter.order = value
      state.history_del.tableData.sorter.field = key
    },
    // 历史删除数据
    [gethisdelete] (state, data) {
      state.history_del.table = data.dataSource
      state.history_del.total = data.total
    }
  }
}
